﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Acme.BookStore.Captchas;
using AutoMapper;
using AutoMapper.Internal.Mappers;
using System.Runtime.InteropServices;
using Volo.Abp.Application.Services;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Domain.Repositories;
using SC.UserCenter.Infra;
namespace Acme.BookStore.Captchass
{
    /// <summary>
    /// 验证验证码
    /// </summary>
    public class CaptchaRepository : ApplicationService, ICaptchaServices
    {
        
        private readonly IRepository<Captcha> captchaRepository;

        public CaptchaRepository(IRepository<Captcha> captchaRepository)
        {
            this.captchaRepository = captchaRepository;
        }
        /// <summary>
        /// 验证验证码
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public async Task<ApiResult> GetByCodeAsync(CaptchaDTO code)
        {
            var list = ObjectMapper.Map<CaptchaDTO, Captcha>(code);
            var  a = await captchaRepository.InsertAsync(list);
            
            return ApiResult.Ok();
        }
    }
}
